# -*- coding: utf-8 -*-
"""
Web framework/Tornado RequestHandler Class/test01.py
"""

import asyncio
import tornado.web


class IndexHandler(tornado.web.RequestHandler):
    def initialize(self, p_a) -> None:
        self.p_a = p_a
        print(p_a)

    def get(self):
        return self.write("It is get method")

    def post(self):
        return self.write("It is post method")


def make_app():
    return tornado.web.Application([
        (r'/', IndexHandler, dict(p_a="123")),
    ])


async def main():
    app = make_app()
    app.listen(8888)
    await asyncio.Event().wait()


if __name__ == "__main__":
    asyncio.run(main())
